package com.bulls.demo.hrmsdemo.service;



import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.PersistenceContext;

import com.bulls.demo.hrmsdemo.ib.LoginLogic;



public class LoginService {

	    private static EntityManager em=null;

        EntityManagerFactory emf;
	
	public boolean isValidUser(String userName,String password){
		boolean boo = false;
		System.out.println("service------------>"+em);


	        emf = Persistence.createEntityManagerFactory("pu");
	        if(emf == null){
	        	System.out.println("em is null");
	        }else{
	        	System.out.println("em is created");
	        }
	        em = emf.createEntityManager();
	        System.out.println("em is created="+em);
		boo  = LoginLogic.isvalidUser(userName, password, em);
		return boo;
	}
	
}
